package com.cqjybigscreen.controller;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.cqjybigscreen.pojo.dto.BoxVolumeDTO;
import com.cqjybigscreen.pojo.vo.BoxVolumeVO;
import com.cqjybigscreen.pojo.vo.EnterpriseStatisticsVO;
import com.cqjybigscreen.service.AdsCqwlCustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * 33618客户货物 前端控制器
 * </p>
 *
 * @author RaoChang
 */
@Slf4j
@RestController
@RequestMapping("adsCqwlCustomer")
public class AdsCqwlCustomerController {

    @Autowired
    private AdsCqwlCustomerService  adsCqwlCustomerService;
    /**
     * 获取客户分布云图
     * @return List<BoxVolumeVO>
     */
    @PostMapping("/getCustomerDistribution")
    public List<BoxVolumeVO> getCustomerDistribution(@RequestBody BoxVolumeDTO dto) {
        if (CollectionUtils.isEmpty(dto.getDirection())) {
            dto.setDirection(Arrays.asList("西向", "北向", "南向", "东向"));
        }
        return adsCqwlCustomerService.getCustomerDistribution(dto.getDirection());
    }

    /**
     * 3361企业数据统计
     * @param dto direction 只需要这个值获取方向联动
     * @return  EnterpriseStatisticsVO
     */
    @PostMapping("/getEnterprise")
    public EnterpriseStatisticsVO getEnterpriseStatistics(@RequestBody BoxVolumeDTO dto) {
        if (CollectionUtils.isEmpty(dto.getDirection())) {
            dto.setDirection(Arrays.asList("西向", "北向", "南向", "东向"));
        }
        return adsCqwlCustomerService.getEnterpriseStatistics(dto);
    }

}
